<template>
	<view class="container">
		<view class="realname" style="width: 94%;margin: 30rpx auto;">
			<bjx-form-item class="realname-user" label-type="inline" prop="introduce">
				<textarea class="realname-content" placeholder="请描述你的问题" v-model="contents" />
			</bjx-form-item>
		</view>
		<view class="submit-box">
			<view class="submit" style="letter-spacing: 4upx;" @tap="conSubmit">
				完成
			</view>
		</view>
	</view>
</template>

<script>
	import {
		mapState,
		mapMutations
	} from 'vuex';
	export default {
		data() {
			return {
				contents: ''
			}
		},
		computed: {
			// ...mapState(['hasLogin']),
		},
		onLoad() {
			// if (!this.hasLogin) {
			// 	this.islogin = true;
			// 	return false
			// }
		},
		methods: {
			...mapMutations(['login', 'logout']),

			async conSubmit() {
				// if (!this.hasLogin) {
				// 	this.islogin = true
				// 	return false;
				// }
				if (!this.contents) {
					this.$toast('请输入反馈内容！');
					return false
				}
				let url = this.$url.suggesting;
				let res = await this.request({
					url: url,
					data: {
						contents: this.contents,
						token: uni.getStorageSync('token')
					},
					method: 'post'
				})

				if (res.status == 1) {
					this.$toast(res.msg);
					setTimeout(() => {
						uni.switchTab({
							url: "/pages/user/user"
						})
					}, 1000)
				} else if (res.status < 0) {
					this.logout()
					this.islogin = true;
				}
			},
		}
	}
</script>

<style lang="scss">
	page {
		background: #FFFFFF;
	}

	.container {
		// #ifdef APP-PLUS
		padding-top: 156rpx;
		// #endif

		// #ifdef MP-WEIXIN
		padding-top: 156rpx;
		// #endif

		// #ifdef H5
		padding-top: 116rpx;
		// #endif
	}

	.realname {
		background: #f7f7f7;
		border-radius: 25upx;
		margin-top: -100rpx;

		.realname-content {
			font-size: 28upx;
			color: #333;
			padding: 22rpx;
			height: 200rpx;
		}
	}

	.submit-box {
		width: 94%;
		margin-left: 3%;
		margin-top: 80upx;

		.submit {
			background-color: #e80909;
			height: 88rpx;
			border-radius: 44rpx;
			color: #fff;
			display: flex;
			align-items: center;
			justify-content: center;
			font-size: 30upx;
		}
	}

	.realname {
		color: #808080 !important;
	}
</style>
